// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Post.java

package dale.web.post.domain;

import dale.web.Domain;
import dale.web.category.domain.Category;
import dale.web.tag.domain.Tag;
import dale.web.user.model.User;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;

public class Post extends Domain
{

    public Post()
    {
        user = new User();
        date = new Date();
    }

    public int getPostNo()
    {
        return postNo;
    }

    public void setPostNo(int postNo)
    {
        this.postNo = postNo;
    }

    public Category getCategory()
    {
        return category;
    }

    public void setCategory(Category category)
    {
        this.category = category;
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle(String titile)
    {
        title = titile;
    }

    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }

    public Date getDate()
    {
        return date;
    }

    public void setDate(Date date)
    {
        this.date = date;
    }

    public int getHit()
    {
        return hit;
    }

    public void setHit(int hit)
    {
        this.hit = hit;
    }

    public List getTagList()
    {
        return tagList;
    }

    public void setTagList(List tagList)
    {
        this.tagList = tagList;
    }

    public String getTags()
    {
        if(CollectionUtils.isEmpty(tagList))
            return "";
        String tags = "";
        for(Iterator iterator = tagList.iterator(); iterator.hasNext();)
        {
            Tag tag = (Tag)iterator.next();
            tags = (new StringBuilder(String.valueOf(tags))).append(tag.getTagID()).append(",").toString();
        }

        tags = tags.substring(0, tags.length() - 1);
        return tags;
    }

    public void setTags(String tags)
    {
        List tagList = new ArrayList();
        String tagsArr[] = tags.split(",");
        String as[];
        int j = (as = tagsArr).length;
        for(int i = 0; i < j; i++)
        {
            String tag = as[i];
            tagList.add(new Tag(tag));
        }

        this.tagList = tagList;
    }

    private static final long serialVersionUID = 1L;
    private int postNo;
    private Category category;
    private String title;
    private String content;
    private User user;
    private Date date;
    private int hit;
    private List tagList;
}
